#include <bits/stdc++.h>
typedef long long ll;
#define int long long
using namespace std;
unordered_map<int, int> m;
bool use2 = false;
signed main() {
  int n, q;
  cin >> n >> q;
  ll sum = 0;
  vector<ll> a(n, 0);
  ll val = 0;
  for (auto &el : a) {
    cin >> el;
    sum += el;
  }
  while (q--) {
    int op;
    cin >> op;
    if (op == 1) {
      int i, x;
      cin >> i >> x;
      if (!use2) {
        sum += x - a[i - 1];
        a[i - 1] = x;
      } else {
        ll prev = 0;
        if (m[i] == 0) {
          prev = val;
        } else {
          prev = m[i];
        }
        m[i] = x;
        sum += x - prev;
      }
    } else {
      int x;
      cin >> x;
      use2 = true;
      m.clear();
      val = x;
      sum = n * x;
    }
    cout << sum << endl;
  }
  return 0;
}
